# -*- coding: utf-8 -*-
import numpy as np

if __name__ == '__main__':
    rand = np.random.rand(2, 3)
    print rand
    where = np.where(rand > 0.5, 1, 0)
    print where
    print "--------------------------------"
    reshape = np.random.rand(12).reshape(3, 4)
    print reshape
    print np.sum(reshape)
    # 同一列相加
    print np.sum(reshape,axis=0)
    # 同一行相加
    print np.sum(reshape,axis=1)
    print np.any(reshape>0.5)
    print np.all(reshape>0.5)
    print "======================="
    ranage = np.array([1, 2, 3, 4, 2, 3])
    print ranage
    print np.unique(ranage)